<template>
    <!--ASN明细-->
    <div id="AsnDetails">
        <v-details :detailData="data.detailData" :inputConfig="inputConfig" :rules="rules" ref="input"></v-details>
    </div>
</template>

<script>

    import details from 'commons/Detail'
    import baseMixin from "@/mixins/BaseMixin";

    export default {
        name: "AsnDetails",
        mixins: [baseMixin],
        props: {
            data: {
                type: Object
            }
        },
        data() {
            return {
                rules: {
                    facility_id: [
                        {required: true, trigger: 'blur'},
                    ],
                    cost_percent: [
                        {required: true, trigger: 'blur'},
                    ],
                    cost_amt: [
                        {required: true, trigger: 'blur'},
                    ],
                    cost_curr_code: [
                        {required: true, trigger: 'blur'},
                    ],
                },
            }
        },
        computed: {
            inputConfig() {
                return [
                    [
                        {
                            type: "select",
                            label: this.$t('bill.wareHouse'),
                            props: "facility_id",
                            options: this.getOptions("getSelectCode/FACILITY_ID/NAME/BIC_FACILITY/1=1")
                        },
                        {
                            type: "select",
                            label: this.$t('bill.customer'),
                            props: "cust_code",
                            options: this.getOptions("getSelectCode/CUST_CODE/NAME/BIC_CUSTOMER/1=1")
                        },
                        {
                            type: "select",
                            label: "货品组",
                            props: "item_group",
                            options: this.getOptions("getSelectCode/ITEM_GROUP/ITEM_GROUP_DESC/BIC_ITEM_GROUP/1=1")
                        }
                    ],
                    [
                        {
                            type: "input",
                            label: this.$t('wave.percentval'),
                            props: "cost_percent",
                        },
                        {
                            type: "input",
                            label: "金额",
                            props: "cost_amt",
                        },
                        {
                            type: "select",
                            label: "货币",
                            props: "cost_curr_code",
                            options: this.getOptions("getSelectCode/CURR_CODE/CURR_DESC/BIC_CURRENCY/1=1")
                        },
                        {
                            type: "input",
                            label: "剩余百分比",
                            props: "percentage",
                            disabled: true
                        },
                    ],
                    [
                        {
                            type: "select",
                            label: this.$t('out.allocation'),
                            props: "cost_alloc",
                            options: this.getOptions("getSelectCode/COST_ALLOC/ALLOC_DESC/BIC_CODE_COSTALLOC/language='zh'"),
                            disabled: true
                        },
                        {
                            type: "input",
                            label: "计费基准",
                            props: "total_basis",
                            disabled: true
                        },
                        {
                            type: "input",
                            label: "UOM",
                            props: "basis_uom",
                            disabled: true
                        },
                    ]
                ]
            }
        },
        methods: {},
        mounted() {
            if (this.$parent.detailNew) {
                this.data.detailData.percentage = this.$parent.$parent.$refs.detail.detailData.percentage;
            }
        },
        watch: {},
        components: {
            'v-details': details
        }
    }
</script>

<style scoped>

</style>
